package com.cskaoyan.market.controller;

import com.cskaoyan.market.db.domain.MarketTopic;
import com.cskaoyan.market.service.WxTopicService;
import com.cskaoyan.market.util.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: 付诚
 * @Date: 2024/5/21 14:3
 * @Description:
 */
@RestController
@RequestMapping("wx/topic")
public class WxTopicController {

    @Autowired
    WxTopicService wxTopicService;

    @GetMapping("list")
    public Object list(Integer page, Integer limit) {

        List<MarketTopic> list = wxTopicService.list(page, limit);
        return ResponseUtil.okList(list);
    }

    @GetMapping("detail")
    public Object detail(Integer id) {

        Map<String, Object> list = wxTopicService.detail(id);
        return ResponseUtil.ok(list);
    }

    @GetMapping("related")
    public Object related(Integer id) {

        List<MarketTopic> topic = wxTopicService.related(id);
        return ResponseUtil.okList(topic);
    }
}
